<?php 
$user = $config['adminLogin'];
$pass = $config['adminPw'];


if ($_POST['login'])
{
	if ($_POST['user'] === $user && $_POST['pass'] === $pass)
	{
		$_SESSION['session'] = 1;
		header("Location: ?page=start");
		exit;
	} else {
		$main['error'] = $jQuery->alert('Wrong username or password!');
	}
}

if ($check->isAdmin())
{
	$main = 'You are already logged in!';
} else {
	$main = '
			<table cellpadding="1" cellspacing="1" width="100%">
				<tr>
					<td>
						'.$main['error'].'

						<form method="post" name="login" action="?page=login">

						<strong>Username:</strong><br />
						<input type="text" name="user" />
						<br />

						<strong>Password:</strong><br />
						<input type="password" name="pass" />
						<br />

						<input type="submit" value="Login" name="login" />
						</form>

					</td>
				</tr>
			</table>
			';
}
?>